<template>
  <div />
</template>

<script>
import { getUrlParam } from "@/utils/common.js";
import { login, singleLogin } from "@/api/dashboard.js";
export default {
  name: "SingleLogin",
  data() {
    return {
      params: [],
      tokenIndex: 0,
      timer: "",
    };
  },
  created() {
    this.$store
      .dispatch("user/singleLoginByToken", window.location.search)
      .then((res) => {
        this.$router.push({ path: "/" });
        //   this.$store.dispatch("getCodeTable");
      });
    // this.singleLogin();
  },
  mounted() {
    // this.getUrlParams();
  },
  destroyed() {},
  methods: {
    getUrlParams() {
      var url = window.location.href;
      var tem = url.split("#")[1];
      var tem2 = tem.split("?")[1];
      var urlParams = tem2.split("&");
      for (var urlParam of urlParams) {
        this.params[urlParam.split("=")[0]] = urlParam.split("=")[1];
      }
    },
    singleLogin() {
      const params = {
        userId: getUrlParam("userid"),
        Remote_addr: getUrlParam("Remote_addr"),
        SystemCode: getUrlParam("SystemCode"),
        md5key: getUrlParam("md5key"),
      };
      singleLogin(params).then((res) => {
        if (res.success) {
          this.$router.push({ path: "/" });
        }
      });
    },
  },
};
</script>

<style rel="stylesheet/scss" lang="scss"></style>
